// function includeExJS(jsFilepath){
//     var exJS = document.createElement('script');
//     exJS.src = jsFilepath;
//     document.head.appendChild(exJS);
// }
// includeExJS("/base.js");

(function (doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function () {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth) return;
                if(clientWidth>=640){
                    docEl.style.fontSize = '100px';
                }else{
                    docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
                }
            };
			
        if (!doc.addEventListener) return;
        recalc();
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);

var AJAXURL = window.location.host.search('dps')!= -1 ? '/dps-jeecg-boot' : '/jeecg-boot';
var AJAXTYPE = "POST";
var AJAXDATATYPE = "json";
var AJAXCONTENTTYPE = 'application/json';
var NETWORK_ERROR = '网络错误，是否重新加载';
var imgList = [];
var imgurl = '';
var searchdays = [31,29,31,30,31,30,31,31,30,31,30,31]
//获取当前时间
function getNow(s) {
return s < 10 ? '0' + s: s;
}

setInterval(function(){
	var myDate = new Date();            
 
	var year=myDate.getFullYear();        //获取当前年
	var month=myDate.getMonth()+1;   //获取当前月
	var date=myDate.getDate();            //获取当前日
	 
	 
	var h=myDate.getHours();              //获取当前小时数(0-23)
	var m=myDate.getMinutes();          //获取当前分钟数(0-59)
	var s=myDate.getSeconds();
	 
	var now=year+'-'+getNow(month)+"-"+getNow(date)+" "+getNow(h)+':'+getNow(m)
	$('.checkin_date_span').text(now)
})

//判断血糖时段
function getSugarTimeTypeByHour(){
	var nowDate = new Date();
	var that = this;
	//获取 此时 年月日 数据
	let hour = nowDate.getHours();
	let timeType;
	let timeLimitArray=[6, 10, 11, 14, 18, 20, 22, 3]
 	var timeTypeArray = ['空腹', '早餐后', '午餐前', '午餐后', '晚餐前', '晚餐后', '睡前', '凌晨', '随机']
	let timeLimit6 = timeLimitArray[0]
	let timeLimit10 = timeLimitArray[1]
	let timeLimit11 = timeLimitArray[2]
	let timeLimit14 =timeLimitArray[3]
	let timeLimit18 =timeLimitArray[4]
	let timeLimit20 =timeLimitArray[5]
	let timeLimit22 = timeLimitArray[6]
	let timeLimit3 = timeLimitArray[7]
	if(hour >= timeLimit6 && hour < timeLimit10) { // 空腹
		timeType = 0
	} else if(hour >= timeLimit10 && hour < timeLimit11) { // 早餐后
		timeType = 1
	} else if(hour >= timeLimit11 && hour < timeLimit14) { // 午餐前
		timeType = 2
	} else if(hour >= timeLimit14 && hour < timeLimit18) { // 午餐后
		timeType = 3
	} else if(hour >= timeLimit18 && hour < timeLimit20) { // 晚餐前
		timeType = 4
	} else if(hour >= timeLimit20 && hour < timeLimit22) { // 晚餐后
		timeType = 5
	} else if(hour >= timeLimit22 && hour < timeLimit3) { // 睡前
		timeType = 6
	} else if(hour >= timeLimit3 && hour < timeLimit6) { // 凌晨
		timeType = 7
	} else {
		timeType = 8
	}
//	return timeType;
	console.log('timeType',timeType)
	$('.checkin_upload_top span').text(timeTypeArray[timeType]+'血糖打卡')
}


function is_android_x5_core(){
var u = navigator.userAgent, app = navigator.appVersion; 
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器 
if( isAndroid ){
    var isWechatQQ = u.indexOf('MicroMessenger') > -1 || u.indexOf('MQQBrowser') > -1;
    if( isWechatQQ )
      return true
}

return false

}